use std::net::UdpSocket;

fn main() -> std::io::Result<()> {
    {
        //客户端也需要创建自己的udp 监听，用于与服务端链接，client端自然也是udp协议
        let socket = UdpSocket::bind("127.0.0.1:34255").expect("couldn't bind to address");
        //连接到服务端
        socket.connect("127.0.0.1:34254").expect("connect function failed");
        //项服务端发送消息
        socket.send("hello!".as_bytes()).expect("couldn't send message");
        println!("end!");
    } // the socket is closed here
    Ok(())
}
